<template lang="">
    <div>
        <van-field label='标题' v-model='form.title'/>
        <van-field label='价格' v-model='form.price'/>
        <select v-model='form.city_id'>
            <option :value="i.id" v-for='i in citylist'>{{i.name}}</option>
        </select>
        <van-uploader :after-read='upload' />
        <van-button @click='add'>提交</van-button>
    </div>
</template>
<script>
export default {
    data(){
        return{
            form:{pic:'',city_id:0},
            citylist:[]
        }
    },
    methods: {
        upload(file){
            //图片上传操作
        },
        add(){

        },
        //获取城市
        getcitylist(){
            this.axios.get('citym').then(res=>{
                if(res.data.code == 200){
                    this.citylist = res.data.list
                    //默认选中第一个
                    this.form.city_id = this.citylist[0]['id']
                }
            })
        }
    },
    mounted() {
        this.getcitylist()
    },
}
</script>
<style lang="">
    
</style>